package com.orhon.smartcampus.modules.systemctl.mm;


import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.modules.base.mm.DictionaryMapper;
import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.systemctl.entity.Modules;
import com.orhon.smartcampus.modules.systemctl.gqlModel.GQLModule;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;
import java.util.Map;

@Mapper(
        uses = {
                //LangMapper.class,
                //DictionaryMapper.class,
                MenuMapper.class
        }
)
public interface ModuleSqlMapper {

    ModuleSqlMapper MAPPER = Mappers.getMapper(ModuleSqlMapper.class);

    //ModuleMapper MAPPER = Mappers.getMapper(ModuleMapper.class);


    default GQLModule toModules(Map entity){
        String json = JSON.toJSONString(entity);
        Modules Module = JSON.parseObject(json , Modules.class);
        GQLModule modules = ModuleMapper.MAPPER.mapModule(Module);
        return modules;
    }


}
